package ui.activity.poscontrol.presenter;


import net.ck.hzq.TobuyApplication;

import javax.inject.Inject;

import base.BaseBiz;
import dao.GetUrlOutput;
import ui.activity.poscontrol.ChangeBackRecordAct;
import ui.activity.poscontrol.HasPushAct;
import ui.activity.poscontrol.MyPosControlAct;
import ui.activity.poscontrol.PushBackRecordAct;
import ui.activity.poscontrol.beanmodel.PosMainBean;
import ui.activity.poscontrol.biz.PosControlMainBiz;
import ui.activity.poscontrol.contract.PosControlMainContract;

/**
 * Created by chenjian on 19/2/26
 */

public class PosControlMainPresenter implements PosControlMainContract.Presenter {

    PosControlMainContract.View view;
    PosControlMainBiz posControlMainBiz;


    @Inject
    public PosControlMainPresenter(PosControlMainContract.View view) {
        this.view = view;
    }


    @Override
    public void setBiz(BaseBiz biz) {
        posControlMainBiz = (PosControlMainBiz) biz;
    }





    @Override
    public void showRightPopWindow() {
        view.showPopWindow();
    }

    @Override
    public void queryRule() {
        posControlMainBiz.queryRule(new BaseBiz.Callback<GetUrlOutput>() {
            @Override
            public void onSuccess(GetUrlOutput getUrlOutput) {
                view.showFlowRuleDialog(getUrlOutput.transfer);
            }

            @Override
            public void onFailure(GetUrlOutput getUrlOutput) {

            }

        });


    }

    @Override
    public void queryInfoData() {
        posControlMainBiz.queryInfoData(TobuyApplication.getCustomId(),new BaseBiz.Callback<PosMainBean>() {
            @Override
            public void onSuccess(PosMainBean posMainBean) {
                view.upDateUI(posMainBean);
            }

            @Override
            public void onFailure(PosMainBean getUrlOutput) {

            }

        });
    }

    @Override
    public void toMyPosControl() {
        view.startAct(MyPosControlAct.class,null);
    }

    @Override
    public void toPushBackControl() {
        view.startAct(PushBackRecordAct.class,null);
    }

    @Override
    public void toHasPushControl() {
        view.startAct(HasPushAct.class,null);
    }
    @Override
    public void toChangeBackControl() {
        view.startAct(ChangeBackRecordAct.class,null);
    }
}
